<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // throw
        function fn(x, y) {
            // 判断是否传参,只要没有传参,就手动抛出一个错误
            if(!x || !y) {
                throw new Error('没有参数传入')
                // throw 可以抛出错误,并且会中断代码执行
                console.log(123)
            }
            return x + y
        }
        console.log(fn(2, 3))
    </script>
</body>
</html>